/*
 * Created on Feb 23, 2009
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.general.appConfig;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import org.apache.log4j.Logger;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author Gopi
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class AppConfigServlet extends HttpServlet{
	
	private static final long serialVersionUID = 1L;
	private final static String CONFIGPATH = "config/spring/generic/lch-prop-config.xml";
	private static Logger log = Logger.getLogger(AppConfigServlet.class);
	
	public void init() throws ServletException {
		ClassPathXmlApplicationContext ctx = null;
		try {
			log.info("Instanciating the Beans from : " + CONFIGPATH);
			ctx = new ClassPathXmlApplicationContext(CONFIGPATH);
			getServletContext().setAttribute("ctx",ctx);
			log.info("SPRING CONTEXT LOADED SUCESSFULLY.");
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}

	}
}
